# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=xerces-c

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.1.1
pkgrel=2
pkgdesc="A validating XML parser written in a portable subset of C++. (mingw-w64)"
arch=('any')
url="http://xerces.apache.org/xerces-c"
license=("APACHE")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs") # "${MINGW_PACKAGE_PREFIX}-curl" "${MINGW_PACKAGE_PREFIX}-icu"
options=('staticlibs' 'strip')
source=("http://mirrors.sonic.net/apache/xerces/c/3/sources/xerces-c-$pkgver.tar.gz")
md5sums=('6a8ec45d83c8cfb1584c5a5345cb51ae')

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  "${srcdir}"/${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST}
  make libxerces_c_la_LDFLAGS="-release 3.1 -no-undefined"
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="$pkgdir" install
  find "${pkgdir}${MINGW_PREFIX}" -name '*.bat' -o -name '*.def' -o -name '*.exp' | xargs -rtl1 rm
}
